package cn.teleware.api.controller;

import cn.teleware.api.service.ApiService;
import cn.teleware.api.vo.UserVO;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author : hongsw
 * @date : 2020-11-12-8:56
 * @descriptions :
 */
@RestController
@RequestMapping("api")
public class ApiController {
    @Resource
    private ApiService service;

    /**
     * 校验分组1-测试接口
     *
     * @param vo 校验对象
     * @return java.lang.String
     * @author hongsw
     * @date 2020/11/12 14:23
     **/
    @PostMapping("checkGroup1")
    public UserVO checkGroup1(@Validated({UserVO.GroupA.class}) UserVO vo) {
        return vo;
    }

    /**
     * 校验分组2-测试接口
     *
     * @param vo 校验对象
     * @return java.lang.String
     * @author hongsw
     * @date 2020/11/12 14:24
     **/
    @PostMapping("checkGroup2")
    public UserVO checkGroup2(@Validated({UserVO.GroupB.class}) UserVO vo) {
        return vo;
    }

    /**
     * 校验自定义规则-测试接口
     *
     * @param vo 校验对象
     * @return cn.teleware.api.vo.UserVO
     * @author hongsw
     * @date 2020/11/12 14:36
     **/
    @PostMapping("checkCustomizeRule")
    public UserVO checkCustomizeRule(@Validated UserVO vo) {
        return vo;
    }

}
